package com.wxjfh.servlet;

import com.wxjfh.Utils.DataUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 移除学生集合指定学生
 * 并重定向到QueryStudentServlet
 */

@WebServlet("/removestudent")
public class RemoveStudentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        System.out.println("删除");
        //获取需要删除的学生姓名
        String studentName = request.getParameter("studentname");
        //删除集合中该学生
        DataUtils.removeStu(studentName);

        response.sendRedirect("/querystudent");



    }
}
